<?php
require_once "/Users/bruno/cvsroot/rambla/RamdapPhp/lib/ramdap/ramdap_object.php";
require_once "/Users/bruno/cvsroot/rambla/RamdapPhp/lib/ramdap/ramdap_except.php";
require_once dirname(__FILE__) . "/../ldap_unittest_create.php";

function createTestUsers() 
{
  try {
    $rats = new Rats(SUPERUSER, SUPERPWD, BASE);
    $rats->setSSL(True);
    $newUser = $rats->createUser(USER, EMAIL, PWD, ENC . ".rambla.be", USER, PWD);
    $newUser = $rats->createUser(SEC_USER, SEC_EMAIL, SEC_PWD, ENC . ".rambla.be", USER, PWD);
  }
  catch(Zend_Gdata_App_Exception $e) {
    assert(False);
  }
}

function deleteTestUsers() {
  try {
    $rats = new Rats(SUPERUSER, SUPERPWD, BASE);
    $rats->setSSL(True);
    $newUser = $rats->deleteUser(USER);
    $newUser = $rats->deleteUser(SEC_USER);
  }
  catch(Zend_Gdata_App_Exception $e) {
    assert(False);
  }
}

function uploadSrc($filename, $local_path) {
  try {
    # upload a src
    $rats = new Rats(USER, PWD, BASE);
    $src_entry = $rats->createSrc($filename, $local_path);
    return $src_entry;
  }
  catch(Zend_Gdata_App_Exception $e) {
    assert(False);
  }
}

function createRassOutput() {
  try {
    # create output profile (rass, no base uri)
    $rats = new Rats(USER, PWD, BASE);
    $output_entry = $rats->createOutput(OUTPUT_RASS, "Rass Output profile for job unittests", METHOD_RASS, CDN01);
    return $output_entry;
  }
  catch(Zend_Gdata_App_Exception $e) {
    assert(False);
  }
}

function createMp4Format() {
  try {
    # create format profile (rass, no base uri)
    $rats = new Rats(USER, PWD, BASE);
    $video_params = array("video_codec" => "mpeg4");
    $audio_params = array("audio_codec" => "aac");
    $format_entry = $rats->createFormat(FORMAT_MP4, DESCRIPTION, CONTAINER_MP4, CATEGORY_FORMATS, $video_params, $audio_params);
    return $format_entry;
  }
  catch(Zend_Gdata_App_Exception $e) {
    assert(False);
  }
}
